home *** CD-ROM | disk | FTP | other *** search
/ PsL Monthly 1993 December / PSL Monthly Shareware CD-ROM (December 1993).iso / prgmming / dos / c / gameprt.exe / GAMEDEMO.C < prev    next >
C/C++ Source or Header  |  1991-08-18  |  1KB  |  53 lines

  1. /*
  2.     Compile with Borland C++ 2.0 using the supplied make file
  3.     make -fgamedemo.mak
  4. */
  5.     
  6. #include <stdio.h>
  7. #include <conio.h>
  8. #include <dos.h>
  9.  
  10. void main()
  11. {
  12.     int i, j, lasti, lastj;
  13.     int b, b1, b2;
  14.     int data[8];
  15.  
  16.     clrscr();
  17.     _setcursortype(_NOCURSOR);
  18.  
  19.     while (!kbhit()) {
  20.         delay(10);
  21.         i = stickx();
  22.         if (lasti != i) {
  23.             lasti = i;
  24.             gotoxy(1, 1);
  25.             printf("X = %3d", i);
  26.         }
  27.         delay(10);
  28.         j = sticky();
  29.         if (lastj != j) {
  30.             lastj = j;
  31.             gotoxy(1, 2);
  32.             printf("Y = %3d", j);
  33.         }
  34.         b = button1();
  35.         if (b1 != b) {
  36.             b1 = b;
  37.             gotoxy(1, 3);
  38.             printf("BUTTON1: %s", (b1) ? "ON " : "OFF");
  39.         }
  40.         b = button2();
  41.         if (b2 != b) {
  42.             b2 = b;
  43.             gotoxy(1, 4);
  44.             printf("BUTTON2: %s", (b2) ? "ON " : "OFF");
  45.         }
  46.     }
  47.     while (kbhit())     /* Gobble keyboard input */
  48.         getch();
  49.  
  50.     _setcursortype(_NORMALCURSOR);
  51.     clrscr();
  52. }
  53.